package com.broada.apm.dao.impl;

import java.util.List;

import com.broada.apm.dao.SettingDao;
import com.broada.apm.model.ConfigItem;

public class MysqlSettingDao extends MysqlAbstractDao implements SettingDao {
	
	public static final String SETTING_NAMESPACE = "com.broada.apm.dao.SettingDao."; 

	@Override
	public void addSetting(ConfigItem configItem) {
		getSqlSession().insert(SETTING_NAMESPACE + "addSetting", configItem);
	}

	@Override
	public void updateSetting(ConfigItem configItem) {
		getSqlSession().update(SETTING_NAMESPACE + "updateSetting", configItem);
	}

	@Override
	public void deleteSetting(ConfigItem configItem) {
		getSqlSession().delete(SETTING_NAMESPACE + "deleteSetting", configItem);
	}

	@Override
	public ConfigItem getSetting(String key) {
		return getSqlSession().selectOne(SETTING_NAMESPACE + "getSetting", key);
	}

	@Override
	public List<ConfigItem> getSettingLikeKey(String key) {
		return getSqlSession().selectList(SETTING_NAMESPACE + "getSettingLikeKey", key);
	}

}
